﻿using CardMaker.Data;
using CardMaker.Library.Services;
using CardMaker.Services;
using Microsoft.Extensions.Logging;

namespace CardMaker
{
    public static class MauiProgram
    {
        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
            builder
                .UseMauiApp<App>()
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                });

            builder.Services.AddMauiBlazorWebView();
            builder.Services.AddBootstrapBlazor();

#if DEBUG
            builder.Services.AddBlazorWebViewDeveloperTools();
		builder.Logging.AddDebug();
#endif

            builder.Services.AddSingleton<WeatherForecastService>();
            builder.Services
                .AddScoped<ICardTemplateStorage, CardTemplateStorage>();
            builder.Services.AddScoped<IPreferenceStorage, PreferenceStorage>();
            builder.Services.AddScoped<ILocalImageService, LocalImageService>();
            builder.Services.AddScoped<ISideImageStorage, SideImageStorage>();
            builder.Services
                .AddScoped<ICardTemplateService, CardTemplateService>();
            builder.Services
                .AddScoped<ICardImageToUrlService, CardImageToUrlService>();
            builder.Services.AddScoped<ICreateCardService, CreateCardService>();
            return builder.Build();
        }
    }
}